<!--
 * @Author: 雷宇航
 * @Date: 2021-08-02 15:16:03
 * @LastEditTime: 2021-08-06 11:59:43
 * @LastEditors: 雷宇航
 * @Description: 
 * @FilePath: \icm-vue\src\views\hifar\contract\modules\ContractSalePurchaseContractDetail.vue
-->
<template>
  <div id="ContractSalePurchaseContractDetail">
    <a-spin :spinning="confirmLoading">
      <a-tabs defaultActiveKey="1">
        <a-tab-pane :tab="index ? index + '、采购合同' : '采购合同'" key="1"></a-tab-pane>
      </a-tabs>
      <a-card v-for="(v, i) in list" :key="i" style="margin: 10px 0">
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          :columns="columns"
          :pagination="false"
          :dataSource="v"
          :loading="loading"
          class="j-table-force-nowrap"
        >
        </a-table>
        <j-editable-table
          :ref="refKeys[0]"
          :loading="ContractSalePurchaseContractDetailTable.loading"
          :columns="ContractSalePurchaseContractDetailTable.columns"
          :dataSource="v[0].contractPurchasePaymentList"
          :disabled="formDisabled"
          :rowNumber="true"
        >
          <template v-slot:payCondition="props">
            <a-popover :content="props.text">
              <div>
                <a-input :value="props.text" :disabled="formDisabled"></a-input>
              </div>
            </a-popover>
          </template>
        </j-editable-table>
      </a-card>
    </a-spin>
  </div>
</template>

<script>
import { FormTypes } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'

export default {
  mixins: [JEditableTableMixin],
  props: {
    list: {
      type: Array,
      default: [{}],
      required: true,
    },
    index: {
      type: Number,
    },
  },
  data() {
    return {
      name: 'ContractSalePurchaseContractDetail',
      confirmLoading: false,
      formDisabled: true,
      loading: false,
      url: {
        list: '/contract/contractPurchaseApply/nonPermissionList',
      },
      refKeys: ['ContractSalePurchaseContractDetail'],
      tableKeys: ['ContractSalePurchaseContractDetail'],
      activeKey: 'ContractSalePurchaseContractDetail',
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '合同编号',
          align: 'center',
          dataIndex: 'num',
          scopedSlots: { customRender: 'num' },
        },
        {
          title: '合同名称',
          align: 'center',
          dataIndex: 'name',
        },
        {
          title: '项目名称',
          align: 'center',
          dataIndex: 'projectName',
        },
        {
          title: '项目编号',
          align: 'center',
          dataIndex: 'projectCode',
        },
        {
          title: '项目经理',
          align: 'center',
          dataIndex: 'charger',
        },
        {
          title: '客户简称',
          align: 'center',
          dataIndex: 'customerName',
        },
        {
          title: '合同金额',
          align: 'center',
          dataIndex: 'money',
        },
        {
          title: '供应商名称',
          align: 'center',
          dataIndex: 'supplierName',
        },
        {
          title: '采购类型',
          align: 'center',
          dataIndex: 'type_dictText',
        },
        {
          title: '销售合同编号',
          align: 'center',
          dataIndex: 'saleNum',
        },
        {
          title: '是否归档',
          align: 'center',
          dataIndex: 'archived_dictText',
        },
        {
          title: '签订日期',
          align: 'center',
          dataIndex: 'signDate',
          customRender: function (text) {
            return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
          },
        },
      ],
      ContractSalePurchaseContractDetailTable: {
        loading: false,
        dataSource: [],
        columns: [
          {
            title: '付款条件',
            key: 'payCondition',
            type: FormTypes.slot,
            width:"28%",
            slotName: 'payCondition',
          },
          {
            title: '计划付款金额(元)',
            key: 'expectMoney',
            width: '14%',
            type: FormTypes.inputNumber,
          },
          {
            title: '计划付款时间',
            key: 'expectTime',
            width: '14%',
            type: FormTypes.date,
          },
          {
            title: '实际付款金额(元)',
            key: 'actualMoney',
            width: '14%',
            type: FormTypes.inputNumber,
          },
          {
            title: '实际付款时间',
            key: 'actualTime',
            type: FormTypes.date,
            width: '14%',
          },
          {
            title: '是否收票',
            type: FormTypes.input,
            width: '8%',
            key: 'billing_dictText',
          },
          {
            title: '付款完成',
            type: FormTypes.input,
            width: '8%',
            key: 'paymentCompleted_dictText',
          },
        ],
      },
    }
  },
  mounted() {},
  methods: {},
}
</script>

<style>
#ContractSalePurchaseContractDetail .input-table .thead {
  overflow-y: auto;
}
#ContractSalePurchaseContractDetail .input-table .scroll-view {
  overflow-y: auto;
}
#ContractSalePurchaseContractDetail .input-table .tbody .tr:last-child {
  border-bottom: 0;
}
</style>
